<%@ page import="javax.naming.Context" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="edu.columbia.ubms.ejb.UserInfoSessionBeanRemote" %>
<%@ page import="edu.columbia.ubms.ejb.Item" %>

<%@ include file="sessionCheck.jsp"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css" href="ubms.css" media="screen" />

<script language="JavaScript">
	function goPage(type) {
		if (type == 'ad') {
			parent.frameBottom.location.href = "adminMain.jsp";
		} else if (type == 'st') {
			parent.frameBottom.location.href = "settingMain.jsp";
		} else if (type == 'lo') {
			parent.location.href = "logout.jsp";
		} else if (type == 'mp') {
			parent.frameBottom.location.href = "mainPageBottom.jsp";
		} else if (type == 'bm') {
			parent.frameBottom.location.href = "bookmarkMain.jsp";
		} else if (type == 'bb') {
			parent.frameBottom.location.href = "blogBoxMain.jsp";
		}
	}
</script>
</head>
<body>
<div class="tab_type01">
 <ul class="tab_navi">
 <%
//int userId = 1;
int userId = (Integer)session.getAttribute("userid");
boolean isAdmin = false;
try {   
    Context ctx = new InitialContext();		
    UserInfoSessionBeanRemote beanRemote = (UserInfoSessionBeanRemote)ctx.lookup("UserInfoSessionBean/remote");
	isAdmin = beanRemote.isAdmin(userId);
} catch(Exception e) {
    out.println("Error:" + e.getMessage());
}	

if (isAdmin) {
%>
  <li class="tab_admin"><a href="#" onClick="goPage('ad');">Admin</a></li>
  <li>|</li>
<%
}
%>
  <li class="tab_setting"><a href="#" onClick="goPage('st');">Setting</a></li>
  <li>|</li>
  <li class="tab_logout"><a href="#" onClick="goPage('lo');">Log out</a></li>
  <br>
  <li class="tab_home"><a href="#" onClick="goPage('mp');">Main Page</a></li>
  <li>|</li>
  <li class="tab_media"><a href="#" onClick="goPage('bm');">Bookmark</a></li>
  <li>|</li>
  <li class="tab_local"><a href="#" onClick="goPage('bb');">Blog</a></li>
 </ul>
</div>

<!--
<table id="mt" cellspacing="0" cellpadding="0" width="30%" border="1" align="right">
<tr>
<th>
 <div class="tab inactive">
 <div class="round4"></div>
 <div class="round2"></div>
 <div class="round1"></div>
 <div class="box-inner">
 <a href="#" onClick="goPage('mp');">Main Page</a>
</th><td>&nbsp;&nbsp;</td>
 </div>
 </div>
 
 <th>
 <div class="tab inactive">
 <div class="round4"></div>
 <div class="round2"></div>
 <div class="round1"></div>
 <div class="box-inner">
 <a href="#" onClick="goPage('bm');">Bookmark</a>
</th><td>&nbsp;&nbsp;</td>
 </div>
 </div>
 
 <th>
 <div class="tab inactive">
 <div class="round4"></div>
 <div class="round2"></div>
 <div class="round1"></div>
 <div class="box-inner">
 <a href="#" onClick="goPage('bb');">Blog Box</a>
</th><td>&nbsp;&nbsp;</td>
 </div>
 </div>
  </th>
 </tr>
 <tr>
</table>

<table cellspacing="0" cellpadding="0" width="30%" align="right" border="1" class="st" vertical-align="bottom">
 <tr>
 <td height=4 align=right class="bevel-right">
 <div class="round4"></div>
 <div class="round2"></div>
 <div class="round1"></div>

 </td>
 </tr>
</table>
-->

</body>
</html>